/*
 *------------------------------------------------------------------------------
 * @File      :    ei_mai_smart.h
 * @Date      :    2021-4-8
 * @Author    :    lomboswer <lomboswer@lombotech.com>
 * @Brief     :    Media Interface for MADP(Media Development Platform).
 *
 * Copyright (C) 2020-2021, LomboTech Co.Ltd. All rights reserved.
 *------------------------------------------------------------------------------
 */

#ifndef __EI_MAI_SMART_H__
#define __EI_MAI_SMART_H__

#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif

#include "ei_mai_smart_define.h"

EI_S32 EI_MAI_SMART_Init(EI_MADP_SMART_ATTR_S *pstSmartAttr);

EI_S32 EI_MAI_SMART_DeInit(EI_VOID);

EI_S32 EI_MAI_SMART_AFrame_Input(AUDIO_DEV AiDevId, AI_CHN AiChn,
	AUDIO_FRAME_S *pstFrame, AEC_FRAME_S *pstAecFrm, EI_VOID *pirv);

EI_S32 EI_MAI_SMART_Frame_Pause(EI_VOID);

EI_S32 EI_MAI_SMART_Frame_Resume(EI_VOID);

EI_S32 EI_MAI_SMART_GetLogLevel(EI_VOID);

EI_S32 EI_MAI_SMART_SetLogLevel(EI_S32 Level);

EI_VOID EI_MAI_SMART_Venc_DrawBGBox(EI_S32 enable);

EI_VOID EI_MAI_SMART_Retain_Ptr(EI_VOID *ptr);

EI_VOID EI_MAI_SMART_Release_Ptr(EI_VOID *ptr);

EI_S32 EI_MAI_SMART_FaceCapInit(EI_HANDLE hFaceCap,
	const EI_MADP_SMART_FACECAP_ATTR_S *pstSmartFaceCapAttr);

EI_S32 EI_MAI_SMART_FaceCapDeInit(EI_HANDLE hFaceCap);

EI_S32 EI_MAI_SMART_FaceCapGetAttr(EI_HANDLE hFaceCap,
	EI_MADP_SMART_FACECAP_ATTR_S *pstSmartFaceCapAttr);

EI_S32 EI_MAI_SMART_FaceCapSetAttr(EI_HANDLE hFaceCap,
	const EI_MADP_SMART_FACECAP_ATTR_S *pstSmartFaceCapAttr);


/**
 * @fn          EI_MAI_SMART_FaceRecgCreate
 * @brief       Create face recg module
 * @param[in]   hFaceRecg face recg module handle
 *               pstSmartFaceRecgAttr recg attr config
 * @param[out]  null
 * @return      0 success, -1 fail
 * @note        make sure EI_MAI_SMART_FaceCapInit has init
 */
EI_S32 EI_MAI_SMART_FaceRecgCreate(EI_HANDLE hFaceRecg,
	const EI_MADP_SMART_FACERECG_ATTR_S *pstSmartFaceRecgAttr);

/**
 * @fn          EI_MAI_SMART_FaceRecgDestroy
 * @brief       Create face recg module
 * @param[in]   hFaceRecg face recg module handle
 * @param[out]  null
 * @return      0 success, -1 fail
 */
EI_S32 EI_MAI_SMART_FaceRecgDestroy(EI_HANDLE hFaceRecg);

/**
 * @fn          EI_MAI_SMART_FaceRecgGetAttr
 * @brief       Get face recg module attr
 * @param[in]   hFaceRecg face recg module handle
 *               pstSmartFaceRecgAttr recg attr config
 * @param[out]  null
 * @return      0 success, -1 fail
 */
EI_S32 EI_MAI_SMART_FaceRecgGetAttr(EI_HANDLE hFaceRecg,
	EI_MADP_SMART_FACERECG_ATTR_S *pstSmartFaceRecgAttr);

/**
 * @fn          EI_MAI_SMART_FaceRecgGetAttr
 * @brief       Get face recg module attr
 * @param[in]   hFaceRecg face recg module handle
 *               pstSmartFaceRecgAttr recg attr config
 * @param[out]  null
 * @return      0 success, -1 fail
 */
EI_S32 EI_MAI_SMART_FaceRecgSetAttr(EI_HANDLE hFaceRecg,
	const EI_MADP_SMART_FACERECG_ATTR_S *pstSmartFaceRecgAttr);

/**
 * @fn          EI_MAI_Smart_FaceRecgGetFeatures
 * @brief       Get face feature by image
 * @param[in]   hFaceRecg face recg module handle
 *               pstFace single face image or has rect kpts info face image
 *               pstFaceImage if pstFaceImage->rect[0] == 0 && pstFaceImage->rect[2] == 0 \n
 *               face det will be performed internally
 * @param[out]  pstFeature face feature
 * @return      0 success, -1 fail detailed by EI_MAI_SMART_Err_Msg
 * @note        pstFaceImage should be memset before use
 */
EI_S32 EI_MAI_SMART_FaceGetFeatures(EI_HANDLE hFaceRecg,
	EI_MADP_SMART_FACERECG_IMAGE_S *pstFaceImage, EI_S32 Normal,
	EI_S32 WithMask, EI_MADP_SMART_FACEFEAT_S *pstFeature);

/**
 * @fn          EI_MAI_SMART_Err_Msg
 * @brief       detailed for EI_MAI_SMART_FaceGetFeatures
 * @param[in]   EI_MAI_SMART_FaceGetFeatures return errcode
 *
 * @return      detailed str
 * @note        pstFaceImage should be memset before use
 */
const char *EI_MAI_SMART_Err_Msg(int errCode);

/**
 * @fn		   EI_MAI_SMART_FaceCompare
 * @brief	   Face feature Compare 1:1
 * @param[in]   hFaceRecg face recg module handle
 *			   pstFace single face image or has rect kpts info face image
 * @param[out]  pstFeature face feature
 * @return	   0 success, -1 fail
 */
EI_S32 EI_MAI_SMART_FaceCompare(EI_HANDLE hFaceRecg,
	EI_MADP_SMART_FACEFEAT_S *pstFeature1,
	EI_MADP_SMART_FACEFEAT_S *pstFeature2, EI_FLOAT *f32Score);

/**
 * @fn          EI_MAI_SMART_FaceRecgCompare
 * @brief       Face feature Compare 1:N
 * @param[in]   hFaceRecg face recg module handle
 *               pstFace single face image or has rect kpts info face image
 * @param[out]  pstFeature face feature
 * @return      0 success, -1 fail
 */
EI_S32 EI_MAI_SMART_FaceRecgCompare(EI_HANDLE hFaceRecg,
	EI_MADP_SMART_FACEFEAT_S *pstFeature, EI_S32 Normal, EI_S32 WithMask,
	EI_MADP_SMART_FACERECG_RESULT_S *pstResult);

/**
 * @fn          EI_MAI_SMART_FaceRegisterFeatures
 * @brief       Face feature register api
 * @param[in]   hFaceRecg face recg module handle
 *               pstFeatures database register face feature
 * @param[out]  null
 * @return      0 success, -1 fail
 */
EI_S32 EI_MAI_SMART_FaceRegisterFeatures(EI_HANDLE hFaceRecg,
	const EI_MADP_SMART_FEATURES_S *pstFeatures);

EI_S32 EI_MAI_SMART_HumanCapInit(EI_HANDLE hHumanCap,
	const EI_MADP_SMART_HUMANCAP_ATTR_S *pstSmartHumanCapAttr);

EI_S32 EI_MAI_SMART_HumanCapDeInit(EI_HANDLE hHumanCap);

EI_S32 EI_MAI_SMART_HumanCapGetAttr(EI_HANDLE hHumanCap,
	EI_MADP_SMART_HUMANCAP_ATTR_S *pstSmartHumanCapAttr);

EI_S32 EI_MAI_SMART_HumanCapSetAttr(EI_HANDLE hHumanCap,
	const EI_MADP_SMART_HUMANCAP_ATTR_S *pstSmartHumanCapAttr);


EI_S32 EI_MAI_SMART_MBGS_Init(EI_HANDLE hMbgsMd,
	const EI_MADP_SMART_MD_ATTR_S *pstSmartMdAttr);

EI_S32 EI_MAI_SMART_MBGS_DeInit(EI_HANDLE hMbgsMd);

EI_S32 EI_MAI_SMART_MBGS_GetAttr(EI_HANDLE hMbgsMd,
	EI_MADP_SMART_MD_ATTR_S *pstSmartMdAttr);

EI_S32 EI_MAI_SMART_MBGS_SetAttr(EI_HANDLE hHumanCap,
	const EI_MADP_SMART_MD_ATTR_S *pstSmartMdAttr);

EI_S32 EI_MAI_SMART_MBGS_SetAttrTest(EI_HANDLE hHumanCap,
	const EI_MADP_SMART_MD_ATTR_S *pstSmartMdAttr);

EI_S32 EI_MAI_SMART_ISPMD_Init(EI_HANDLE hISPMd,
	const EI_MADP_SMART_ISPMD_ATTR_S *pstSmartISPMdAttr);

EI_S32 EI_MAI_SMART_ISPMD_DeInit(EI_HANDLE hISPMd);

EI_S32 EI_MAI_SMART_ISPMD_GetAttr(EI_HANDLE hISPMd,
	EI_MADP_SMART_ISPMD_ATTR_S *pstSmartISPMdAttr);

EI_S32 EI_MAI_SMART_ISPMD_SetAttr(EI_HANDLE hISPMd,
	const EI_MADP_SMART_ISPMD_ATTR_S *pstSmartISPMdAttr);

EI_S32 EI_MAI_SMART_LPD_Init(EI_HANDLE hLpd,
	const EI_MADP_SMART_LPD_ATTR_S *pstSmartLpdAttr);

EI_S32 EI_MAI_SMART_LPD_DeInit(EI_HANDLE hLpd);

EI_S32 EI_MAI_SMART_LPD_SetAttr(EI_HANDLE hLpd,
	const EI_MADP_SMART_LPD_ATTR_S *pstSmartLpdAttr);

EI_S32 EI_MAI_SMART_LPD_GetAttr(EI_HANDLE hLpd,
	EI_MADP_SMART_LPD_ATTR_S *pstSmartLpdAttr);


EI_S32 EI_MAI_SMART_PNV_Init(EI_HANDLE hPnv,
	const EI_MADP_SMART_PNV_ATTR_S *pstSmartPnvAttr);

EI_S32 EI_MAI_SMART_PNV_DeInit(EI_HANDLE hPnv);

EI_S32 EI_MAI_SMART_PNV_SetAttr(EI_HANDLE hPnv,
	const EI_MADP_SMART_PNV_ATTR_S *pstSmartPnvAttr);

EI_S32 EI_MAI_SMART_PNV_GetAttr(EI_HANDLE hPnv,
	EI_MADP_SMART_PNV_ATTR_S *pstSmartPnvAttr);


EI_S32 EI_MAI_SMART_CAR_Init(EI_HANDLE hPnv,
	const EI_MADP_SMART_CAR_ATTR_S *pstSmartPnvAttr);

EI_S32 EI_MAI_SMART_CAR_DeInit(EI_HANDLE hPnv);

EI_S32 EI_MAI_SMART_CAR_SetAttr(EI_HANDLE hPnv,
	const EI_MADP_SMART_CAR_ATTR_S *pstSmartPnvAttr);

EI_S32 EI_MAI_SMART_CAR_GetAttr(EI_HANDLE hPnv,
	EI_MADP_SMART_CAR_ATTR_S *pstSmartPnvAttr);


EI_S32 EI_MAI_SMART_SED_Init(EI_HANDLE hSed,
	const EI_MADP_SMART_SED_ATTR_S *pstSmartSedAttr);

EI_S32 EI_MAI_SMART_SED_DeInit(EI_HANDLE hSed);

EI_S32 EI_MAI_SMART_SED_SetAttr(EI_HANDLE hSed,
	const EI_MADP_SMART_SED_ATTR_S *pstSmartSedAttr);

EI_S32 EI_MAI_SMART_SED_GetAttr(EI_HANDLE hSed,
	EI_MADP_SMART_SED_ATTR_S *pstSmartSedAttr);


EI_S32 EI_MAI_SMART_Noise_Init(EI_HANDLE hNoiseDet,
	const EI_MADP_SMART_NOISE_ATTR_S *pstSmartNoiseAttr);

EI_S32 EI_MAI_SMART_Noise_DeInit(EI_HANDLE hNoiseDet);

EI_S32 EI_MAI_SMART_Noise_SetAttr(EI_HANDLE hNoiseDet,
	const EI_MADP_SMART_NOISE_ATTR_S *pstSmartNoiseAttr);

EI_S32 EI_MAI_SMART_Noise_GetAttr(EI_HANDLE hNoiseDet,
	EI_MADP_SMART_NOISE_ATTR_S *pstSmartNoiseAttr);

EI_S32 EI_MAI_SMART_QR_Init(EI_HANDLE hQRDet,
	const EI_MADP_SMART_QR_ATTR_S *pstSmartQRAttr);

EI_VOID EI_MAI_SMART_Region_Info(EI_MADP_SMART_OSD_ADD_S *reigon, EI_S32 n);

EI_S32 EI_MAI_SMART_CTL_DET_FrameRate(EI_MADP_SMART_DET_FRAME_RATE_S *pstDetStatus);

EI_S32 EI_MAI_SMART_HAND_Init(EI_HANDLE hHand,
	const EI_MADP_SMART_HAND_ATTR_S * pstSmartHandAttr);

EI_S32 EI_MAI_SMART_HAND_DeInit(EI_HANDLE hHand);

/* for test */
EI_S32 EI_MAI_SMART_CTL_SetFaceCapRecgStep(EI_U32 step);

#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif

#endif /* __EI_MAI_SMART_H__ */

